package com.shrcl.engineerprocess.domain.events;

import com.shrcl.engineerprocess.domain.EngineerProjectJob;
import com.shrcl.engineerprocess.domain.EngineerWorkOrder;
import com.shrcl.engineerprocess.domain.events.EngineerProjectJobEventsListener;
import edu.fudan.mylang.pf.event.EntityEventsManager;
import java.util.Collection;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("com.shrcl.engineerprocess.domain.events.EngineerProjectJobEventsManager")
public class EngineerProjectJobEventsManager extends EntityEventsManager<EngineerProjectJob> {
  @Autowired(required = false)
  private Collection<EngineerProjectJobEventsListener> listeners = com.google.common.collect.Lists.newArrayList();;
  
  protected Collection<EngineerProjectJobEventsListener> getListeners() {
    return listeners;
  }
  
  public void fireExecute(final EngineerProjectJob entity) {
    for (edu.fudan.mylang.pf.event.IEntityEventsListner<?> listener : listeners) {
    	((EngineerProjectJobEventsListener)listener).execute(entity);
    }
    
  }
  
  public void fireFinish(final EngineerProjectJob entity) {
    for (edu.fudan.mylang.pf.event.IEntityEventsListner<?> listener : listeners) {
    	((EngineerProjectJobEventsListener)listener).finish(entity);
    }
    
  }
  
  public void fireCreateWorkOrder(final EngineerProjectJob entity, final Procedure1<? super EngineerWorkOrder> init) {
    for (edu.fudan.mylang.pf.event.IEntityEventsListner<?> listener : listeners) {
    	((EngineerProjectJobEventsListener)listener).createWorkOrder(entity,init);
    }
    
  }
  
  public void fireDelWorkOrder(final EngineerProjectJob entity, final EngineerWorkOrder engineerWorkOrder) {
    for (edu.fudan.mylang.pf.event.IEntityEventsListner<?> listener : listeners) {
    	((EngineerProjectJobEventsListener)listener).delWorkOrder(entity,engineerWorkOrder);
    }
    
  }
  
  public void fire$workOrderFinish(final EngineerProjectJob entity) {
    for (edu.fudan.mylang.pf.event.IEntityEventsListner<?> listener : listeners) {
    	((EngineerProjectJobEventsListener)listener).$workOrderFinish(entity);
    }
    
  }
}
